package com.ldzy.service.serviceIpmI;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ldzy.dao.PayMapper;
import com.ldzy.dao.RecordMapper;
import com.ldzy.pojo.Pay;
import com.ldzy.pojo.Record;
import com.ldzy.service.IPayService;
import com.ldzy.service.IRecordService;
import com.ldzy.utilts.RespUtil;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

@Service
public class IPayServiceIpmI extends ServiceImpl<PayMapper, Pay> implements IPayService {
    @Resource PayMapper payMapper;

    @Override
    public RespUtil insertPay(Pay pay) {
        if (payMapper.insertPay(pay)!=0)
            return  RespUtil.success("操作成功！！！",pay.getOrderId());
        return RespUtil.error("操作失败!!!");
    }

    @Override
    public RespUtil updateAddress(Pay pay) {
        if (payMapper.updateAddress(pay)!=0)
            return  RespUtil.success("操作成功！！！");
        return RespUtil.error("操作失败!!!");
    }

    @Override
    public RespUtil findByPayUser(Pay pay) {
        if (payMapper.findByPayUser(pay).size()!=0)
            return  RespUtil.success(payMapper.findByPayUser(pay));
        return  RespUtil.error();
    }

    @Override
    public void updatePayType(Pay pay) {
        payMapper.updatePayType(pay);
    }
}
